package com.zrx.controller;

import com.zrx.annotation.SystemLog;
import com.zrx.domain.ResponseResult;
import com.zrx.domain.entity.User;
import com.zrx.domain.vo.UserInfoVo;
import com.zrx.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 张荣欣
 * @create ：2022/9/20  14:37
 */
@RestController
@RequestMapping("/user")
@Api(tags = "用户")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/userInfo")
    @ApiOperation(value = "获取用户信息",notes = "获取用户信息")
    public ResponseResult userInfo(){
        return userService.userInfo();
    }

    @PutMapping("/userInfo")
    @ApiOperation(value = "更新用户信息",notes = "更新用户信息")
    @SystemLog(businessName = "更新用户信息")
    public ResponseResult updateUserInfo(@RequestBody User user){
        return userService.updateUserInfo(user);
    }

    @PostMapping("/register")
    @ApiOperation(value = "注册用户信息",notes = "注册用户信息")
    public ResponseResult register(@RequestBody User user){
        return userService.register(user);
    }
}
